package my.ptu.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class OrderController {

    @Autowired
    RestTemplate restTemplate;

    @GetMapping("/order/add")
    public String addUserInfo() {
//        String url = "http://user-service/useInfo/add";
        String url = "http://userservice/useInfo/add";
        String object = restTemplate.getForObject(url, String.class);
        return object;
    }

    @GetMapping("/userInfo/get/{id}")
    public String queryUserByUserId(@PathVariable("id") Long id) {
        return "userInfoService.queryUserByUserId(id)";
    }
}
